import type { App, Directive } from 'vue'
import copy from './modules/copy'
import debounce from './modules/debounce'
import previewImage from './modules/previewImage'
import auth from './modules/auth'

const directivesList: { [key: string]: Directive } = {
  copy,
  debounce,
  previewImage,
  auth
}

const directives = {
  install: function (app: App<Element>) {
    Object.keys(directivesList).forEach((key) => {
      // 注册所有自定义指令
      app.directive(key, directivesList[key])
    })
  }
}

export default directives
